@(message: String)

<!DOCTYPE html>

<html>
    <head>
        <title>Badugi Poker Game</title>
        <link rel="stylesheet" media="screen" href="@routes.Assets.at("stylesheets/main.css")">
        <link rel="shortcut icon" type="image/png" href="@routes.Assets.at("images/favicon.png")">
        <style>
        .msg {
        	border: 1px solid;
        	border-radius: 10px;
        	margin-top: 2px;
        	margin-bottom: 2px;
        	background:#766868;
        	box-shadow: 6px 6px 3px #888888
        }
        .msg2 {
           	border: 1px solid;
        	border-radius: 10px;
        	margin-top: 2px;
        	margin-bottom: 2px;
        	background:#766868;
        	box-shadow: 6px 6px 3px #888888     
        }
        </style>
        	<script>
				function check()
				{
					var xmlhttp;
					if (window.XMLHttpRequest)
					{// code for IE7+, Firefox, Chrome, Opera, Safari
						xmlhttp=new XMLHttpRequest();
					}
					else
					{// code for IE6, IE5
						xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
					}
					xmlhttp.onreadystatechange=function()
					{
						if (xmlhttp.readyState==4 && xmlhttp.status==200)
						{
							var para = document.createElement("div");
							para.className = "msg";
							var para2 = document.createElement("p");
							para.appendChild(para2);
							var node = document.createTextNode(xmlhttp.responseText);
							para2.appendChild(node);
							var element = document.getElementById("div2");
							element.insertBefore(para, element.childNodes[0]);
						}
					}
						xmlhttp.open("GET","/check", true);
						xmlhttp.send();
				}
				function bet()
				{
					var xmlhttp;
					if (window.XMLHttpRequest)
					{// code for IE7+, Firefox, Chrome, Opera, Safari
						xmlhttp=new XMLHttpRequest();
					}
					else
					{// code for IE6, IE5
						xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
					}
					xmlhttp.onreadystatechange=function()
					{
						if (xmlhttp.readyState==4 && xmlhttp.status==200)
						{
							var para = document.createElement("div");
							para.className = "msg";
							var para2 = document.createElement("p");
							para.appendChild(para2);
							var node = document.createTextNode(xmlhttp.responseText);
							para2.appendChild(node);
							var element = document.getElementById("div2");
							element.insertBefore(para, element.childNodes[0]);
						}
					}
						var str1 = document.getElementById("betInput").value;
						var str2 = "/bet/";
						var str3 = str2.concat(str1);
						
						xmlhttp.open("GET", str3, true);
						xmlhttp.send();
						document.getElementById("betInput").value = "";
				}
				function raise()
				{
					var xmlhttp;
					if (window.XMLHttpRequest)
					{// code for IE7+, Firefox, Chrome, Opera, Safari
						xmlhttp=new XMLHttpRequest();
					}
					else
					{// code for IE6, IE5
						xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
					}
					xmlhttp.onreadystatechange=function()
					{
						if (xmlhttp.readyState==4 && xmlhttp.status==200)
						{
							var para = document.createElement("div");
							para.className = "msg";
							var para2 = document.createElement("p");
							para.appendChild(para2);
							var node = document.createTextNode(xmlhttp.responseText);
							para2.appendChild(node);
							var element = document.getElementById("div2");
							element.insertBefore(para, element.childNodes[0]);
						}
					}
						var str1 = document.getElementById("betInput").value;
						var str2 = "/raise/";
						var str3 = str2.concat(str1);
						xmlhttp.open("GET", str3, true);
						xmlhttp.send();
						document.getElementById("betInput").value = "";
				}
				function call2()
				{
					var xmlhttp;
					if (window.XMLHttpRequest)
					{// code for IE7+, Firefox, Chrome, Opera, Safari
						xmlhttp=new XMLHttpRequest();
					}
					else
					{// code for IE6, IE5
						xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
					}
					xmlhttp.onreadystatechange=function()
					{
						if (xmlhttp.readyState==4 && xmlhttp.status==200)
						{
							var para = document.createElement("div");
							para.className = "msg";
							var para2 = document.createElement("p");
							para.appendChild(para2);
							var node = document.createTextNode(xmlhttp.responseText);
							para2.appendChild(node);
							var element = document.getElementById("div2");
							element.insertBefore(para, element.childNodes[0]);
						}
					}
						xmlhttp.open("GET","/call", true);
						xmlhttp.send();
				}
				function fold()
				{
					var xmlhttp;
					if (window.XMLHttpRequest)
					{// code for IE7+, Firefox, Chrome, Opera, Safari
						xmlhttp=new XMLHttpRequest();
					}
					else
					{// code for IE6, IE5
						xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
					}
					xmlhttp.onreadystatechange=function()
					{
						if (xmlhttp.readyState==4 && xmlhttp.status==200)
						{
							var para = document.createElement("div");
							para.className = "msg";
							var para2 = document.createElement("p");
							para.appendChild(para2);
							var node = document.createTextNode(xmlhttp.responseText);
							para2.appendChild(node);
							var element = document.getElementById("div2");
							element.insertBefore(para, element.childNodes[0]);
						}
					}
						xmlhttp.open("GET","/fold", true);
						xmlhttp.send();
				}
				function allin()
				{
					var xmlhttp;
					if (window.XMLHttpRequest)
					{// code for IE7+, Firefox, Chrome, Opera, Safari
						xmlhttp=new XMLHttpRequest();
					}
					else
					{// code for IE6, IE5
						xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
					}
					xmlhttp.onreadystatechange=function()
					{
						if (xmlhttp.readyState==4 && xmlhttp.status==200)
						{
							var para = document.createElement("div");
							para.className = "msg";
							var para2 = document.createElement("p");
							para.appendChild(para2);
							var node = document.createTextNode(xmlhttp.responseText);
							para2.appendChild(node);
							var element = document.getElementById("div2");
							element.insertBefore(para, element.childNodes[0]);
						}
					}
						xmlhttp.open("GET","/allin", true);
						xmlhttp.send();
				}
				function send()
				{
					var xmlhttp;
					if (window.XMLHttpRequest)
					{// code for IE7+, Firefox, Chrome, Opera, Safari
						xmlhttp=new XMLHttpRequest();
					}
					else
					{// code for IE6, IE5
						xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
					}
					xmlhttp.onreadystatechange=function()
					{
						if (xmlhttp.readyState==4 && xmlhttp.status==200)
						{
							var para = document.createElement("div");
							para.className = "msg";
							var para2 = document.createElement("p");
							para.appendChild(para2);
							var node = document.createTextNode(xmlhttp.responseText);
							para2.appendChild(node);
							var element = document.getElementById("div2");
							element.insertBefore(para, element.childNodes[0]);
						}
					}
						var str1 = document.getElementById("cardInput").value;
						if (!str1.trim())
							{
								str1 = "no";
							}
						var str2 = "/changeCards/";
						var str3 = str2.concat(str1);
						xmlhttp.open("GET", str3, true);
						xmlhttp.send();
						document.getElementById("cardInput").value = "";
				}
				function play()
				{
					var xmlhttp;
					if (window.XMLHttpRequest)
					{// code for IE7+, Firefox, Chrome, Opera, Safari
						xmlhttp=new XMLHttpRequest();
					}
					else
					{// code for IE6, IE5
						xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
					}
					xmlhttp.onreadystatechange=function()
					{
						if (xmlhttp.readyState==4 && xmlhttp.status==200)
						{
							var para = document.createElement("div");
							para.className = "msg";
							var para2 = document.createElement("p");
							para.appendChild(para2);
							var node = document.createTextNode(xmlhttp.responseText);
							para2.appendChild(node);
							var element = document.getElementById("div2");
							element.insertBefore(para, element.childNodes[0]);
						}
					}
						xmlhttp.open("GET","/next", true);
						xmlhttp.send();
				}
				
			</script>
    </head>
    <body style = "background:#000000">
    	<header style="background:#000000; height:80px; box-shadow: 10px 10px 5px #888888; margin-right:-40px; margin-left:-40px; margin-top:-10px;">
    	<div style="margin-left:25%; margin-right:25%"><img alt="" src="@routes.Assets.at("images/logo.png")"></img></div>
    	</header>
		<div id="buttons" style="background:#CCCCB2; padding: 1% 1% 1% 1%; float:right; width: 200px; box-shadow: 10px 10px 5px #888888; border-radius: 15px; margin-top:4%; position:fixed; right: 30px; ">
			<div id="changing">
				<input id="cardInput" type="text" name="Which cards to change" value="" placeholder="F.e. TTFT" size="10"><br>
				<div><button id="send" onclick="send()">Change Cards</button></div>
			</div>
			<div id="betting" style="padding-top: 8%; ">
				<input id="betInput" type="text" name="Value of bet" value="" placeholder="Value" size="10"><br>
				<div><button id="check" onclick="check()">Check</button></div>
				<div><button id="bet" onclick="bet()">Bet</button></div>
				<div><button id="raise" onclick="raise()">Raise</button></div>
				<div><button id="call" onclick="call2()">Call</button></div>
				<div><button id="fold" onclick="fold()">Fold</button></div>
				<div><button id="allin" onclick="allin()">All-In</button></div>
				<div><button id="play" onclick="play()">Continue (next game)</button></div>
			</div>
		</div>
		
		<div id="panel" style="background:#CCCCB2; padding: 1% 1% 1% 1%; float:right; width: 200px; box-shadow: 10px 10px 5px #888888; border-radius: 15px; margin-top:4%; position:fixed; left: 30px; ">
	   		<div><p>Your Bankroll: <span id="myTokens"></span></p></div>
	   		<div><p>Card 1: <span id="0"></span></p></div>
	   		<div><p>Card 2: <span id="1"></span></p></div>
	   		<div><p>Card 3: <span id="2"></span></p></div>
	   		<div><p>Card 4: <span id="3"></span></p></div>
	    </div>
	    
	    <div style="margin-left:25%; margin-right:25%; margin-top: 5%;">
	    	<div id="div2">
	    		<div class="msg">@message</div>
	    	</div>
	    </div>
	    
        <script>
        function load()
        {
    		var xmlhttp;
    		if (window.XMLHttpRequest)
    		  {// code for IE7+, Firefox, Chrome, Opera, Safari
    		  xmlhttp=new XMLHttpRequest();
    		  }
    		else
    		  {// code for IE6, IE5
    		  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    		  }
    		xmlhttp.onreadystatechange=function()
    		  {
    		  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    		    {
	    			var str = xmlhttp.responseText;
	    			if (str.trim())
	    				{
			    		  	var str2 = str.replace("&quot;", " ");
							var stra = str2.split("*");
							var i = 0;
							for (i = 0; i < stra.length; i++)
							{
								if (stra[i].trim())
									{
							          var para = document.createElement("div");
							   			para.className = "msg";
							          var para2 = document.createElement("p");
							          para.appendChild(para2);
							          var node = document.createTextNode(stra[i]);
							          para2.appendChild(node);
							          var element = document.getElementById("div2");
							          element.insertBefore(para, element.childNodes[0]);
									}
							}
							if (str2.search("Your current bankroll is") != -1)
								{
									var n = str2.indexOf("Your current bankroll is");
									n += 25;
									document.getElementById("myTokens").innerHTML = str2.substr(n,4);
								}
							if (str2.search("Cards have come:") != -1)
								{
									var i = 0;
									var index = 0;
									for (i = 0; i < stra.length; i++)
										{
											if (stra[i].search("Cards have come:") != -1)
												index = i;
										}
									var handArray = stra[index].replace("Cards have come:", " ").split(",");
									
									for (i = 0; i < 4; i++)
										{
										document.getElementById(i).innerHTML = handArray[i];
										}
								}
	    				}

    		    }
    		}
    		xmlhttp.open("GET","/chat", true);
    		xmlhttp.send();       	
        }
       var myVar = setInterval(function(){ load() }, 2000)

        </script>
        
    </body>
</html>
